package com.ymcv.proyecto7.model.dao;


import com.ymcv.proyecto7.model.connection.UtilDB;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public abstract class ICRUD {

	protected Context context;
	protected SQLiteDatabase db;
	protected Cursor c;
	protected ContentValues cv;
	protected UtilDB util;

	public ICRUD(Context context) {
		this.context = context;
		util = new UtilDB(context);
	}

	

	public void cerrar() {
		if (c != null) {
			c.close();
		}
		if (cv != null) {
			cv.clear();
		}

		if (db != null) {
			if (db.inTransaction()) {
				db.endTransaction();
			}
			db.close();
		}
	}

	public void exito() {
		if (db != null) {
			db.setTransactionSuccessful();
		}
	}
}
